package sunbao.ido.config;

import org.springframework.boot.context.event.ApplicationStartingEvent;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.Ordered;

/**
 * \* User: MeiZhongHao
 * \* Date: 2018-11-12
 * \* Time: 17:09
 * \* Description: 项目启动时的监听器
 * \
 */
public class ConfigApplicationListener implements ApplicationListener<ApplicationEvent>, Ordered {


    @Override
    public int getOrder() {
        return Integer.MIN_VALUE;
    }

    @Override
    public void onApplicationEvent(ApplicationEvent event) {
        if (event instanceof ApplicationStartingEvent) {
            this.onApplicationStartingEvent((ApplicationStartingEvent) event);
        }
    }

    private void onApplicationStartingEvent(ApplicationStartingEvent event) {
        System.out.println(event.toString());
    }
}